package com.ruoyi.biz.letter.service.impl;

import java.util.List;

import com.ruoyi.biz.letter.util.AcceptDeptUtil;
import com.ruoyi.biz.letter.util.CategoryUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.biz.letter.mapper.BizLeaderMailboxMapper;
import com.ruoyi.biz.letter.domain.BizLeaderMailbox;
import com.ruoyi.biz.letter.service.IBizLeaderMailboxService;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 省住建厅官网厅长信箱Service业务层处理
 *
 * @author Fei.Cong
 * @date 2024-07-11
 */
@Service
public class BizLeaderMailboxServiceImpl extends ServiceImpl<BizLeaderMailboxMapper, BizLeaderMailbox> implements IBizLeaderMailboxService {

    @Autowired
    private BizLeaderMailboxMapper bizLeaderMailboxMapper;

    /**
     * 分页查询省住建厅官网厅长信箱
     *
     * @param page
     * @param bizLeaderMailbox 省住建厅官网厅长信箱
     */
    @Override
    public IPage<BizLeaderMailbox> pageList(BizLeaderMailbox bizLeaderMailbox, IPage<BizLeaderMailbox> page) {
        IPage<BizLeaderMailbox> resultPage = bizLeaderMailboxMapper.selectPageList(page, bizLeaderMailbox);
        for (BizLeaderMailbox record : resultPage.getRecords()) {
            record.setFirstCategoryName(CategoryUtil.getCacheCategory(record.getPCategoryId()));
            record.setSecondCategoryName(CategoryUtil.getCacheCategory(record.getSCategoryId()));
            AcceptDeptUtil.parseAcceptDept(record);
        }
        return resultPage;
    }

    /**
     * 条件查询省住建厅官网厅长信箱
     *
     * @param bizLeaderMailbox 省住建厅官网厅长信箱
     * @return
     */
    @Override
    public List<BizLeaderMailbox> queryList(BizLeaderMailbox bizLeaderMailbox) {
        LambdaQueryWrapper<BizLeaderMailbox> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        return bizLeaderMailboxMapper.selectList(lambdaQueryWrapper);
    }
}
